package com.ctg.itrdc.imageconsole.data.dao;

import java.util.List;
import java.util.Map;

import com.ctg.itrdc.imageconsole.data.dto.DockerImageIndexDTO;
import com.ctg.itrdc.imageconsole.data.entity.DockerImageTag;
import com.ctg.itrdc.paspsdk.common.entity.PageInfo;
import com.ctg.itrdc.paspsdk.data.dao.IBaseCacheDao;
import com.ctg.itrdc.paspsdk.data.dao.IBaseDao;

/**
 * 
 * @Description 
 * @author <a href="mailto:18070514058@163.com">Piao.Wu</a>
 * @Data 2016年5月18日
 * @Version 1.0.0
 */
public interface IDockerImageTagDao extends IBaseCacheDao, IBaseDao  {
	
	PageInfo<DockerImageTag> jdbcFindPageInfo(DockerImageTag entity, int currentPage, int perPageNum);

	/**
	 * 根据pserverId、imageFileId、version查找对象
	 * @param pserverId
	 * @param imageFileId
	 * @param version
	 * @return
	 */
	DockerImageTag findDockerImageIndex(Long pserverId,Long imageFileId,String version);
	
	
	DockerImageTag findByServerIdImageNameVersion(Long pserverId,String imageName,String version);
	
	
	/**
	 * 以docker_image_file_id,version分组，并且状态为000，并且docker_pserver_id在指定集合中的记录
	 * @param pserverIds
	 * @return
	 */
	List<DockerImageTag> findEveryImagesGroupBy(List<Long> pserverIds);
	
	
	/**
	 * 以docker_image_file_id,version查询，并且状态为000，并且docker_pserver_id在指定集合中的记录
	 * @param pserverIds
	 * @param imageFileId
	 * @param version
	 * @return
	 */
	List<DockerImageTag> findIndexsByfileIdAndVersion(List<Long> pserverIds,Long imageFileId,String version);

    /**
     * 找到组下000:不稳定 001:正常状态的记录
     * @return
     */
	List<DockerImageTag> findNormalDockerImageIndex(List<Long> pserverIds);
	
	/**
	 * 更新正常
	 */
	void updateNormalDockerImageIndexState(List<Long> dockerImageIndexList );
	
	PageInfo<DockerImageIndexDTO> findByImageFileId(Long imageFileId, Integer currentPage, Integer perPageNum);

	List<DockerImageTag> findByDockerPserverId(Long dockerPserverId);
	
	List<DockerImageTag> findByImageFileIdAndVersion(Long imageFileId,String version);

	DockerImageTag selectByImageNameAndVersion(String tenantCodeImageName, String imageVersion);

	DockerImageTag queryNormalStateByEntity(String imageName, String version);
	
	DockerImageTag selectById(Long id);

	List<DockerImageTag> selectByImageName(String imageName);
	
	List<DockerImageTag> selectByTagIdMap(String imageName, Map<Long, Long> tagIdMap);
	
}
